var orderlist_obj = {
		orderlist_find:function(){
			var sign = 1;
			$(".orderlist .title ul li a").click(function() {
				if(bool){
					  $(".orderlist .title ul li a").removeClass("active");
						$(this).addClass("active");
						sign = $(this).attr("id");
						$(".case").html("");
						loadpage=1;
					    orderlist_obj.loadhtml(loadpage,sign);
						$(window).scroll(function(){
							 if ($(document).scrollTop() >= $(document).height() - $(window).height() && signal == true) {
//				                    alert("滚动条已经到达底部为" + $(document).scrollTop());
								 	loadpage++;
								 	orderlist_obj.loadhtml(loadpage,sign);
				                }
						});
				}
		      
		    })
//		    alert(sign);
		    //滑动刷新
		    var loadpage=1;
		    orderlist_obj.loadhtml(loadpage,sign);
			$(window).scroll(function(){
				 if ($(document).scrollTop() >= $(document).height() - $(window).height() && signal == true) {
//	                    alert("滚动条已经到达底部为" + $(document).scrollTop());
					 	loadpage++;
					 	orderlist_obj.loadhtml(loadpage,sign);
	                }
			});
		},
		
		//加载订单信息
		loadhtml:function(loadpage,sign){
			bool = false;
			signal = false;
			$(".loading_box").show();
			$.post('?s=Vip/orderlist/p/'+loadpage,"sign="+sign,function(data){
				if(data.ret==1){
					
					var html="";
					for(var i=0;i<data.msg.length;i++){
			            	html+='<div class="subtitle"><i class="fl">订单号：'+data.msg[i]["ordernumber"]+'</i><i class="fr">'+data.msg[i]["createtime"]+'</i></div>'
			                html+='<dl class="clearfix">'
			                html+='<dt><img src="'+data.msg[i]["coverimg"]+'"></dt>'
			                html+='<dd><p>'+data.msg[i]["productname"]+'</p></dd>'
			                if(sign == 1){
			                	 html+='<dd><div class="btns"><a href="?s=/Vip/refundreason/id/'+data.msg[i]["id"]+'">退款</a></div></dd>'
			                }else if(sign ==2){
			                	 html+='<dd><div class="btns"><a href="?s=/Vip/shopconfirm/id/'+data.msg[i]["id"]+'">确认收货</a></div></dd>'
			                }else if(sign == 4){
			                	 html+='<dd><div class="btns"><a href="?s=/Vip/refundreason/id/'+data.msg[i]["id"]+'">退款</a></div></dd>'
			                }else{
			                	 html+=''
			                }
			               
			            	html+='<dd><span>总价：<i>￥'+data.msg[i]["totalprice"]+'</i><br>共<i>'+data.msg[i]["buynumber"]+'</i>件<br><a href="?s=/Vip/orderdetail/id/'+data.msg[i]["id"]+'">查看详情&gt;&gt;</a></span></dd>'
			                html+='</dl>'
			                html+='</div>'
					}
					$(".case").append(html);
					bool = true;
					signal = true;
					$(".loading_box").hide();
				}else{
					if(loadpage==1){
						$(".case").append('<div class="morewords">暂无该类型订单!</div>');
						bool = true;
						$(".loading_box").hide();
					}else{
//						$(".case").append('<div class="morewords">没有更多团!</div>');
						$(".loading_box").hide();
						bool = true;
					}
				}
			});
		}
}